(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.notifyTpl.viewController', viewController);
	viewController.$inject = [ '$scope', 'Constants', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'notifyTplService' ];
	function viewController($scope, Constants, layoutConfig, validatorConfig, gridService, authService, notifyTplService) {
		var ctrl = this, params = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.notifyTpl = {};

		ctrl.init = function() {
			ctrl.notifyTplMimeTypeOptions = notifyTplService.getNotifyTplMimeTypeOptions();
			ctrl.yesNoOptions = {};
			notifyTplService.getYesNoOptions().then(function(response){
				angular.extend(ctrl.yesNoOptions, response);
				authService.view(params).then(function(response) {
					ctrl.notifyTpl = response.data || params;
					notifyTplService.getNotifyPartyAndNotifyTypeOptions(ctrl);
				}, angular.noop);
			});
		};
	}
})(angular);